#include <iostream>
#include <string>
class AbstractSystem // 抽象的被代理对象
{
public:
    virtual void run() = 0; // 系统运行函数
};

class MySystem : public AbstractSystem
{
    void run()
    {
        std::cout << "普通用户启动!\n";
    }
};

class AdminSystem : public AbstractSystem
{
    void run()
    {
        std::cout << "管理员用户启动!\n";
    }
};

class Proxy
{
private:
    AbstractSystem *s;

public:
    void Login(const std::string &name, const std::string &passwd)
    {
        if (name == "root" && passwd == "123456")
        {
            s = new AdminSystem;
            s->run();
        }
        else if (name == "ubuntu" && passwd == "123")
        {
            s = new MySystem;
            s->run();
        }
    }
};

int main()
{
    Proxy p;
    p.Login("root", "123456");
    return 0;
}